aboutsummaryrefslogtreecommitdiff
path: root/src/app/manga/[title]/[id]/[read]
diff options
context:
space:
mode:
authorzephex <[email protected]>2024-04-20 13:34:53 +0530
committerzephex <[email protected]>2024-04-20 13:34:53 +0530
commitd6780cf3dad729c69a102ba2940188cf1e6bcbf4 (patch)
treed10a2aefef6664c42439f165c73722c514b032bc /src/app/manga/[title]/[id]/[read]
parentfeature added: tracker for mangas (diff)
downloaddramalama-d6780cf3dad729c69a102ba2940188cf1e6bcbf4.tar.xz
dramalama-d6780cf3dad729c69a102ba2940188cf1e6bcbf4.zip
idk whats happening
Diffstat (limited to 'src/app/manga/[title]/[id]/[read]')
-rw-r--r--src/app/manga/[title]/[id]/[read]/currentReading.jsx68
-rw-r--r--src/app/manga/[title]/[id]/[read]/download.jsx42
-rw-r--r--src/app/manga/[title]/[id]/[read]/page.jsx112
-rw-r--r--src/app/manga/[title]/[id]/[read]/read.module.css128
4 files changed, 175 insertions, 175 deletions
diff --git a/src/app/manga/[title]/[id]/[read]/currentReading.jsx b/src/app/manga/[title]/[id]/[read]/currentReading.jsx
index 0050d61..5205ea9 100644
--- a/src/app/manga/[title]/[id]/[read]/currentReading.jsx
+++ b/src/app/manga/[title]/[id]/[read]/currentReading.jsx
@@ -1,34 +1,34 @@
-"use client";
-
-import styles from "./read.module.css";
-import { useEffect } from "react";
-
-function get_current_info(title) {
- let req = {};
-
- useEffect(() => {
- const data = JSON.parse(localStorage.getItem("mangaData"));
- data.watchHis.forEach((element) => {
- if (element.title === title) {
- req.chapter = element.chapter;
- req.volume = element.volume;
- }
- });
- }, []);
-
- return req || false;
-}
-
-export default function Current({ name: title }) {
- let data = get_current_info(title);
- if (!data) {
- return;
- }
-
- return (
- <section className={styles.CurrentMain}>
- <p className={styles.CurrentChapter}>{data.chapter}</p>
- <p className={styles.CurrentVolume}>{data.volume}</p>
- </section>
- );
-}
+"use client";
+
+import styles from "./read.module.css";
+import { useEffect } from "react";
+
+function get_current_info(title) {
+ let req = {};
+
+ useEffect(() => {
+ const data = JSON.parse(localStorage.getItem("mangaData"));
+ data.watchHis.forEach((element) => {
+ if (element.title === title) {
+ req.chapter = element.chapter;
+ req.volume = element.volume;
+ }
+ });
+ }, []);
+
+ return req || false;
+}
+
+export default function Current({ name: title }) {
+ let data = get_current_info(title);
+ if (!data) {
+ return;
+ }
+
+ return (
+ <section className={styles.CurrentMain}>
+ <p className={styles.CurrentChapter}>{data.chapter}</p>
+ <p className={styles.CurrentVolume}>{data.volume}</p>
+ </section>
+ );
+}
diff --git a/src/app/manga/[title]/[id]/[read]/download.jsx b/src/app/manga/[title]/[id]/[read]/download.jsx
index e7a20ee..bddf6d3 100644
--- a/src/app/manga/[title]/[id]/[read]/download.jsx
+++ b/src/app/manga/[title]/[id]/[read]/download.jsx
@@ -1,21 +1,21 @@
-"use client";
-
-import styles from "./read.module.css";
-
-export default function DownloadManga({ chapterId: id }) {
- return (
- <div className={styles.DownloadMain}>
- <a
- href={`https://manga-downloader-7nca.onrender.com/download?id=${id}`}
- style={{ textDecoration: "none" }}
- onClick={() =>
- alert(
- "Downloads are not instant. It might take some time to prepare your file. Thank you for your patience"
- )
- }
- >
- <button title="should work just fine">Download - Beta</button>
- </a>
- </div>
- );
-}
+"use client";
+
+import styles from "./read.module.css";
+
+export default function DownloadManga({ chapterId: id }) {
+ return (
+ <div className={styles.DownloadMain}>
+ <a
+ href={`https://manga-downloader-7nca.onrender.com/download?id=${id}`}
+ style={{ textDecoration: "none" }}
+ onClick={() =>
+ alert(
+ "Downloads are not instant. It might take some time to prepare your file. Thank you for your patience"
+ )
+ }
+ >
+ <button title="should work just fine">Download - Beta</button>
+ </a>
+ </div>
+ );
+}
diff --git a/src/app/manga/[title]/[id]/[read]/page.jsx b/src/app/manga/[title]/[id]/[read]/page.jsx
index dbba6e0..a4181d7 100644
--- a/src/app/manga/[title]/[id]/[read]/page.jsx
+++ b/src/app/manga/[title]/[id]/[read]/page.jsx
@@ -1,56 +1,56 @@
-import styles from "./read.module.css";
-import Image from "next/image";
-import DownloadManga from "./download";
-
-export default async function Read({ params }) {
- const chapterId = params.read;
- const results = await getPages(chapterId);
- const image_base_url = results.baseUrl + "/data/" + results.chapter.hash;
-
- if (results.length === 0) {
- return (
- <div className={styles.NotFound}>
- <p>
- This chapter has no content. Please check the next chapter.
- </p>
- </div>
- );
- }
-
- let images = [];
- for (var i = 0; i < results.chapter.data.length; i++) {
- var imgUrl = image_base_url + "/" + results.chapter.data[i];
- images.push(imgUrl);
- }
-
- return (
- <div className={styles.Main}>
- <div className={styles.ImageContainer}>
- <DownloadManga chapterId={chapterId} />
- <p>Total pages: {images.length}</p>
- {images &&
- images.map((item, index) => (
- <div className={styles.Image} key={index}>
- <Image
- src={`https://sup-proxy.zephex0-f6c.workers.dev/api-content?url=${item}`}
- key={index}
- alt="Pages"
- width={800}
- height={1000}
- priority
- quality={100}
- unoptimized
- />
- <p>{index + 1}</p>
- </div>
- ))}
- </div>
- </div>
- );
-}
-
-async function getPages(id) {
- const res = await fetch(`https://api.mangadex.org/at-home/server/${id}`);
- const data = await res.json();
- return data;
-}
+import styles from "./read.module.css";
+import Image from "next/image";
+import DownloadManga from "./download";
+
+export default async function Read({ params }) {
+ const chapterId = params.read;
+ const results = await getPages(chapterId);
+ const image_base_url = results.baseUrl + "/data/" + results.chapter.hash;
+
+ if (results.length === 0) {
+ return (
+ <div className={styles.NotFound}>
+ <p>
+ This chapter has no content. Please check the next chapter.
+ </p>
+ </div>
+ );
+ }
+
+ let images = [];
+ for (var i = 0; i < results.chapter.data.length; i++) {
+ var imgUrl = image_base_url + "/" + results.chapter.data[i];
+ images.push(imgUrl);
+ }
+
+ return (
+ <div className={styles.Main}>
+ <div className={styles.ImageContainer}>
+ <DownloadManga chapterId={chapterId} />
+ <p>Total pages: {images.length}</p>
+ {images &&
+ images.map((item, index) => (
+ <div className={styles.Image} key={index}>
+ <Image
+ src={`https://sup-proxy.zephex0-f6c.workers.dev/api-content?url=${item}`}
+ key={index}
+ alt="Pages"
+ width={800}
+ height={1000}
+ priority
+ quality={100}
+ unoptimized
+ />
+ <p>{index + 1}</p>
+ </div>
+ ))}
+ </div>
+ </div>
+ );
+}
+
+async function getPages(id) {
+ const res = await fetch(`https://api.mangadex.org/at-home/server/${id}`);
+ const data = await res.json();
+ return data;
+}
diff --git a/src/app/manga/[title]/[id]/[read]/read.module.css b/src/app/manga/[title]/[id]/[read]/read.module.css
index 420fff8..0133232 100644
--- a/src/app/manga/[title]/[id]/[read]/read.module.css
+++ b/src/app/manga/[title]/[id]/[read]/read.module.css
@@ -1,65 +1,65 @@
-.Main {
- margin: 80px auto;
-}
-
-.Image {
- display: flex;
- flex-direction: column;
- align-items: center;
- background-color: #1b1b1b;
- border-radius: 10px;
- width: 50%;
- margin: 10px auto;
-}
-
-.ImageContainer img {
- max-width: auto;
- height: auto;
- border-radius: 5px;
- margin-top: 10px;
-}
-
-.ImageContainer p {
- text-align: center;
- color: white;
- font-family: "Atkinson Hyperlegible", serif;
- font-size: 16px;
- margin: 5px;
-}
-
-.NotFound {
- text-align: center;
- color: white;
- font-family: "Atkinson Hyperlegible", serif;
- font-size: 20px;
-}
-
-.DownloadMain {
- text-align: center;
-}
-
-.DownloadMain button {
- border: none;
- outline: none;
- border-radius: 5px;
- padding: 5px;
- font-family: "Atkinson Hyperlegible", serif;
- font-size: 16px;
- background-color: var(--light-green);
- cursor: pointer;
-}
-
-.DownloadMain button:hover {
- background-color: var(--pastel-red);
-}
-
-@media screen and (max-width: 768px) {
- .ImageContainer img {
- width: 95%;
- align-items: center;
- }
-
- .Image {
- width: 100%;
- }
+.Main {
+ margin: 80px auto;
+}
+
+.Image {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ background-color: #1b1b1b;
+ border-radius: 10px;
+ width: 50%;
+ margin: 10px auto;
+}
+
+.ImageContainer img {
+ max-width: auto;
+ height: auto;
+ border-radius: 5px;
+ margin-top: 10px;
+}
+
+.ImageContainer p {
+ text-align: center;
+ color: white;
+ font-family: "Atkinson Hyperlegible", serif;
+ font-size: 16px;
+ margin: 5px;
+}
+
+.NotFound {
+ text-align: center;
+ color: white;
+ font-family: "Atkinson Hyperlegible", serif;
+ font-size: 20px;
+}
+
+.DownloadMain {
+ text-align: center;
+}
+
+.DownloadMain button {
+ border: none;
+ outline: none;
+ border-radius: 5px;
+ padding: 5px;
+ font-family: "Atkinson Hyperlegible", serif;
+ font-size: 16px;
+ background-color: var(--light-green);
+ cursor: pointer;
+}
+
+.DownloadMain button:hover {
+ background-color: var(--pastel-red);
+}
+
+@media screen and (max-width: 768px) {
+ .ImageContainer img {
+ width: 95%;
+ align-items: center;
+ }
+
+ .Image {
+ width: 100%;
+ }
} \ No newline at end of file